<%@ page language="java" import="java.util.*" pageEncoding="utf-8"
	isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
    String path = request.getContextPath();
			String basePath = request.getScheme() + "://"
					+ request.getServerName() + ":" + request.getServerPort()
					+ path + "/";
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="<%=request.getContextPath()%>/css/style.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath()%>/css/select.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.idTabs.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/select-ui.min.js"></script>
<script type="text/javascript">
	function chongzhi(a){
		var recharge_money = $(a).val(); 
		if(!/^\d+$/.test(recharge_money)){ 
			alert("请输入正整数");
			$(a).val($(a).next().val());
		}
	}
</script>
</head>

<body>

	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><e>首页</e></li>
    <li><e>财务管理</e></li>
    <li><e>优惠券使用规则</e></li>                                        
    </ul>
    </div>
    
    <div class="formbody">
    
    
    <div id="usual1" class="usual"> 
    
    <div class="itab">
  	<ul> 
    <li><a href="#tab1" class="selected" style="font-size:15">优惠券使用规则</a></li> 
    
  	</ul>
    </div> 
    
  	<div id="tab1" class="tabson">
    <ul class="forminfo">
    <c:forEach items="${lists}" var="data">
    <li>5元优惠券&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;满
    	<input onchange="chongzhi(this)" name="wu" type="text" class="dfinput" style="width:40px;height:20px;" value="${data.five_ticket}"/>可用
    	<input type="hidden" value="${data.five_ticket}"/>
    </li>
    <li>10元优惠券&nbsp;&nbsp;&nbsp;满
    	<input onchange="chongzhi(this)" name="shi" type="text" class="dfinput" style="width:40px;height:20px;" value="${data.ten_ticket}"/>可用
    	<input type="hidden" value="${data.ten_ticket}"/>
    </li>
    <li>20元优惠券&nbsp;&nbsp;&nbsp;满
    	<input onchange="chongzhi(this)" name="ershi" type="text" class="dfinput" style="width:40px;height:20px;" value="${data.twenty_ticket}"/>可用
    	<input type="hidden" value="${data.twenty_ticket}"/>
    </li>
    <li>50元优惠券&nbsp;&nbsp;&nbsp;满
    	<input onchange="chongzhi(this)" name="wushi" type="text" class="dfinput" style="width:40px;height:20px;" value="${data.fifty_ticket}"/>可用
   		<input type="hidden" value="${data.fifty_ticket}"/>
    </li>
    <li>100元优惠券&nbsp;满
    	<input onchange="chongzhi(this)" name="yibai" type="text" class="dfinput" style="width:40px;height:20px;" value="${data.hundred_ticket}"/>可用
   		<input type="hidden" value="${data.hundred_ticket}"/>
    </li>
    </c:forEach>
    </ul>
    <div style="margin-left:50px;"><input name="" type="button" class="tijiao" value="提交" style="width:96px; height:35px; line-height:35px; color:#fff; background:red; font-size:14px; font-weight:bold;border-radius: 3px; cursor:pointer;"/>
    </div> 
  </div>
  <script type="text/javascript">
  	$(function(){
  		$(".tijiao").click(function(){
  			var five_ticket = $("input[name=wu]").val();
  			var ten_ticket = $("input[name=shi]").val();
  			var twenty_ticket = $("input[name=ershi]").val();
  			var fifty_ticket = $("input[name=wushi]").val();
  			var hundred_ticket = $("input[name=yibai]").val();
  			if(five_ticket == "" || ten_ticket == "" || twenty_ticket == "" || fifty_ticket == "" || hundred_ticket == ""){
  				alert("请先设置金额");
  				return;
  			}
  			$.ajax({
  				type:"get",
  				url:"/htx-backer/rechargeSet", 
  				data:{
  					five_ticket:five_ticket,
  					ten_ticket:ten_ticket,
  					twenty_ticket:twenty_ticket,
  					fifty_ticket:fifty_ticket,
  					hundred_ticket:hundred_ticket
  				},
  				dataType:"json",
  				success:function(data){
  					if(data.flag > 0){
  					 	var btn = confirm("提交成功,点击返回充值面额设置!")
		   				window.location.href="/htx-backer/selectCommontDiscount";
  					}
  				}
			}) 
  		})
  	})
  </script>
</body>
</html>
